<?php


/**
 * Base class that represents a query for the 'summary' table.
 *
 *
 *
 * @method EmpevalSummaryQuery orderByUserId($order = Criteria::ASC) Order by the user_id column
 * @method EmpevalSummaryQuery orderByBonusGoalsFormId($order = Criteria::ASC) Order by the bonus_goals_form_id column
 * @method EmpevalSummaryQuery orderByTargetCategory($order = Criteria::ASC) Order by the target_category column
 * @method EmpevalSummaryQuery orderByPeriod($order = Criteria::ASC) Order by the period column
 * @method EmpevalSummaryQuery orderByRecommendation($order = Criteria::ASC) Order by the recommendation column
 * @method EmpevalSummaryQuery orderByRecommendationDesc($order = Criteria::ASC) Order by the recommendation_desc column
 * @method EmpevalSummaryQuery orderByEvaluation($order = Criteria::ASC) Order by the evaluation column
 * @method EmpevalSummaryQuery orderByQualifications($order = Criteria::ASC) Order by the qualifications column
 * @method EmpevalSummaryQuery orderByOperationalArea($order = Criteria::ASC) Order by the operational_area column
 * @method EmpevalSummaryQuery orderByStatus($order = Criteria::ASC) Order by the status column
 * @method EmpevalSummaryQuery orderByActive($order = Criteria::ASC) Order by the active column
 * @method EmpevalSummaryQuery orderByLastModified($order = Criteria::ASC) Order by the last_modified column
 * @method EmpevalSummaryQuery orderByCreated($order = Criteria::ASC) Order by the created column
 *
 * @method EmpevalSummaryQuery groupByUserId() Group by the user_id column
 * @method EmpevalSummaryQuery groupByBonusGoalsFormId() Group by the bonus_goals_form_id column
 * @method EmpevalSummaryQuery groupByTargetCategory() Group by the target_category column
 * @method EmpevalSummaryQuery groupByPeriod() Group by the period column
 * @method EmpevalSummaryQuery groupByRecommendation() Group by the recommendation column
 * @method EmpevalSummaryQuery groupByRecommendationDesc() Group by the recommendation_desc column
 * @method EmpevalSummaryQuery groupByEvaluation() Group by the evaluation column
 * @method EmpevalSummaryQuery groupByQualifications() Group by the qualifications column
 * @method EmpevalSummaryQuery groupByOperationalArea() Group by the operational_area column
 * @method EmpevalSummaryQuery groupByStatus() Group by the status column
 * @method EmpevalSummaryQuery groupByActive() Group by the active column
 * @method EmpevalSummaryQuery groupByLastModified() Group by the last_modified column
 * @method EmpevalSummaryQuery groupByCreated() Group by the created column
 *
 * @method EmpevalSummaryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method EmpevalSummaryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method EmpevalSummaryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method EmpevalSummaryQuery leftJoinBonusGoalsForms($relationAlias = null) Adds a LEFT JOIN clause to the query using the BonusGoalsForms relation
 * @method EmpevalSummaryQuery rightJoinBonusGoalsForms($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BonusGoalsForms relation
 * @method EmpevalSummaryQuery innerJoinBonusGoalsForms($relationAlias = null) Adds a INNER JOIN clause to the query using the BonusGoalsForms relation
 *
 * @method EmpevalSummaryQuery leftJoinViewBgfWithSuperiorPositionId($relationAlias = null) Adds a LEFT JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
 * @method EmpevalSummaryQuery rightJoinViewBgfWithSuperiorPositionId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
 * @method EmpevalSummaryQuery innerJoinViewBgfWithSuperiorPositionId($relationAlias = null) Adds a INNER JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
 *
 * @method EmpevalSummaryQuery leftJoinUsers($relationAlias = null) Adds a LEFT JOIN clause to the query using the Users relation
 * @method EmpevalSummaryQuery rightJoinUsers($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Users relation
 * @method EmpevalSummaryQuery innerJoinUsers($relationAlias = null) Adds a INNER JOIN clause to the query using the Users relation
 *
 * @method EmpevalSummary findOne(PropelPDO $con = null) Return the first EmpevalSummary matching the query
 * @method EmpevalSummary findOneOrCreate(PropelPDO $con = null) Return the first EmpevalSummary matching the query, or a new EmpevalSummary object populated from the query conditions when no match is found
 *
 * @method EmpevalSummary findOneByUserId(int $user_id) Return the first EmpevalSummary filtered by the user_id column
 * @method EmpevalSummary findOneByBonusGoalsFormId(int $bonus_goals_form_id) Return the first EmpevalSummary filtered by the bonus_goals_form_id column
 * @method EmpevalSummary findOneByTargetCategory(int $target_category) Return the first EmpevalSummary filtered by the target_category column
 * @method EmpevalSummary findOneByPeriod(int $period) Return the first EmpevalSummary filtered by the period column
 * @method EmpevalSummary findOneByRecommendation(string $recommendation) Return the first EmpevalSummary filtered by the recommendation column
 * @method EmpevalSummary findOneByRecommendationDesc(string $recommendation_desc) Return the first EmpevalSummary filtered by the recommendation_desc column
 * @method EmpevalSummary findOneByEvaluation(string $evaluation) Return the first EmpevalSummary filtered by the evaluation column
 * @method EmpevalSummary findOneByQualifications(string $qualifications) Return the first EmpevalSummary filtered by the qualifications column
 * @method EmpevalSummary findOneByOperationalArea(string $operational_area) Return the first EmpevalSummary filtered by the operational_area column
 * @method EmpevalSummary findOneByStatus(int $status) Return the first EmpevalSummary filtered by the status column
 * @method EmpevalSummary findOneByActive(boolean $active) Return the first EmpevalSummary filtered by the active column
 * @method EmpevalSummary findOneByLastModified(string $last_modified) Return the first EmpevalSummary filtered by the last_modified column
 * @method EmpevalSummary findOneByCreated(string $created) Return the first EmpevalSummary filtered by the created column
 *
 * @method array findByUserId(int $user_id) Return EmpevalSummary objects filtered by the user_id column
 * @method array findByBonusGoalsFormId(int $bonus_goals_form_id) Return EmpevalSummary objects filtered by the bonus_goals_form_id column
 * @method array findByTargetCategory(int $target_category) Return EmpevalSummary objects filtered by the target_category column
 * @method array findByPeriod(int $period) Return EmpevalSummary objects filtered by the period column
 * @method array findByRecommendation(string $recommendation) Return EmpevalSummary objects filtered by the recommendation column
 * @method array findByRecommendationDesc(string $recommendation_desc) Return EmpevalSummary objects filtered by the recommendation_desc column
 * @method array findByEvaluation(string $evaluation) Return EmpevalSummary objects filtered by the evaluation column
 * @method array findByQualifications(string $qualifications) Return EmpevalSummary objects filtered by the qualifications column
 * @method array findByOperationalArea(string $operational_area) Return EmpevalSummary objects filtered by the operational_area column
 * @method array findByStatus(int $status) Return EmpevalSummary objects filtered by the status column
 * @method array findByActive(boolean $active) Return EmpevalSummary objects filtered by the active column
 * @method array findByLastModified(string $last_modified) Return EmpevalSummary objects filtered by the last_modified column
 * @method array findByCreated(string $created) Return EmpevalSummary objects filtered by the created column
 *
 * @package    propel.generator.empeval.om
 */
abstract class EmpevalBaseSummaryQuery extends ModelCriteria
{
    /**
     * Initializes internal state of EmpevalBaseSummaryQuery object.
     *
     * @param     string $dbName The dabase name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = 'vgp_empeval', $modelName = 'EmpevalSummary', $modelAlias = null)
    {
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new EmpevalSummaryQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param     EmpevalSummaryQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return EmpevalSummaryQuery
     */
    public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof EmpevalSummaryQuery) {
            return $criteria;
        }
        $query = new EmpevalSummaryQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     * <code>
     * $obj = $c->findPk(array(12, 34), $con);
     * </code>
     *
     * @param array $key Primary key to use for the query
                         A Primary key composition: [$user_id, $bonus_goals_form_id]
     * @param     PropelPDO $con an optional connection object
     *
     * @return   EmpevalSummary|EmpevalSummary[]|mixed the result, formatted by the current formatter
     */
    public function findPk($key, $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = EmpevalSummaryPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
            // the object is alredy in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getConnection(EmpevalSummaryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return   EmpevalSummary A model object, or null if the key is not found
     * @throws   PropelException
     */
    protected function findPkSimple($key, $con)
    {
        $sql = 'SELECT USER_ID, BONUS_GOALS_FORM_ID, TARGET_CATEGORY, PERIOD, RECOMMENDATION, RECOMMENDATION_DESC, EVALUATION, QUALIFICATIONS, OPERATIONAL_AREA, STATUS, ACTIVE, LAST_MODIFIED, CREATED FROM summary WHERE USER_ID = :p0 AND BONUS_GOALS_FORM_ID = :p1';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
            $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $obj = new EmpevalSummary();
            $obj->hydrate($row);
            EmpevalSummaryPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return EmpevalSummary|EmpevalSummary[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    }

    /**
     * Find objects by primary key
     * <code>
     * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
     * </code>
     * @param     array $keys Primary keys to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return PropelObjectCollection|EmpevalSummary[]|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($stmt);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {
        $this->addUsingAlias(EmpevalSummaryPeer::USER_ID, $key[0], Criteria::EQUAL);
        $this->addUsingAlias(EmpevalSummaryPeer::BONUS_GOALS_FORM_ID, $key[1], Criteria::EQUAL);

        return $this;
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {
        if (empty($keys)) {
            return $this->add(null, '1<>1', Criteria::CUSTOM);
        }
        foreach ($keys as $key) {
            $cton0 = $this->getNewCriterion(EmpevalSummaryPeer::USER_ID, $key[0], Criteria::EQUAL);
            $cton1 = $this->getNewCriterion(EmpevalSummaryPeer::BONUS_GOALS_FORM_ID, $key[1], Criteria::EQUAL);
            $cton0->addAnd($cton1);
            $this->addOr($cton0);
        }

        return $this;
    }

    /**
     * Filter the query on the user_id column
     *
     * Example usage:
     * <code>
     * $query->filterByUserId(1234); // WHERE user_id = 1234
     * $query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34)
     * $query->filterByUserId(array('min' => 12)); // WHERE user_id > 12
     * </code>
     *
     * @see       filterByUsers()
     *
     * @param     mixed $userId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByUserId($userId = null, $comparison = null)
    {
        if (is_array($userId) && null === $comparison) {
            $comparison = Criteria::IN;
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::USER_ID, $userId, $comparison);
    }

    /**
     * Filter the query on the bonus_goals_form_id column
     *
     * Example usage:
     * <code>
     * $query->filterByBonusGoalsFormId(1234); // WHERE bonus_goals_form_id = 1234
     * $query->filterByBonusGoalsFormId(array(12, 34)); // WHERE bonus_goals_form_id IN (12, 34)
     * $query->filterByBonusGoalsFormId(array('min' => 12)); // WHERE bonus_goals_form_id > 12
     * </code>
     *
     * @see       filterByBonusGoalsForms()
     *
     * @see       filterByViewBgfWithSuperiorPositionId()
     *
     * @param     mixed $bonusGoalsFormId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByBonusGoalsFormId($bonusGoalsFormId = null, $comparison = null)
    {
        if (is_array($bonusGoalsFormId) && null === $comparison) {
            $comparison = Criteria::IN;
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::BONUS_GOALS_FORM_ID, $bonusGoalsFormId, $comparison);
    }

    /**
     * Filter the query on the target_category column
     *
     * Example usage:
     * <code>
     * $query->filterByTargetCategory(1234); // WHERE target_category = 1234
     * $query->filterByTargetCategory(array(12, 34)); // WHERE target_category IN (12, 34)
     * $query->filterByTargetCategory(array('min' => 12)); // WHERE target_category > 12
     * </code>
     *
     * @param     mixed $targetCategory The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByTargetCategory($targetCategory = null, $comparison = null)
    {
        if (is_array($targetCategory)) {
            $useMinMax = false;
            if (isset($targetCategory['min'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::TARGET_CATEGORY, $targetCategory['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($targetCategory['max'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::TARGET_CATEGORY, $targetCategory['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::TARGET_CATEGORY, $targetCategory, $comparison);
    }

    /**
     * Filter the query on the period column
     *
     * Example usage:
     * <code>
     * $query->filterByPeriod(1234); // WHERE period = 1234
     * $query->filterByPeriod(array(12, 34)); // WHERE period IN (12, 34)
     * $query->filterByPeriod(array('min' => 12)); // WHERE period > 12
     * </code>
     *
     * @param     mixed $period The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByPeriod($period = null, $comparison = null)
    {
        if (is_array($period)) {
            $useMinMax = false;
            if (isset($period['min'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::PERIOD, $period['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($period['max'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::PERIOD, $period['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::PERIOD, $period, $comparison);
    }

    /**
     * Filter the query on the recommendation column
     *
     * Example usage:
     * <code>
     * $query->filterByRecommendation('fooValue');   // WHERE recommendation = 'fooValue'
     * $query->filterByRecommendation('%fooValue%'); // WHERE recommendation LIKE '%fooValue%'
     * </code>
     *
     * @param     string $recommendation The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByRecommendation($recommendation = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($recommendation)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $recommendation)) {
                $recommendation = str_replace('*', '%', $recommendation);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::RECOMMENDATION, $recommendation, $comparison);
    }

    /**
     * Filter the query on the recommendation_desc column
     *
     * Example usage:
     * <code>
     * $query->filterByRecommendationDesc('fooValue');   // WHERE recommendation_desc = 'fooValue'
     * $query->filterByRecommendationDesc('%fooValue%'); // WHERE recommendation_desc LIKE '%fooValue%'
     * </code>
     *
     * @param     string $recommendationDesc The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByRecommendationDesc($recommendationDesc = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($recommendationDesc)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $recommendationDesc)) {
                $recommendationDesc = str_replace('*', '%', $recommendationDesc);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::RECOMMENDATION_DESC, $recommendationDesc, $comparison);
    }

    /**
     * Filter the query on the evaluation column
     *
     * Example usage:
     * <code>
     * $query->filterByEvaluation('fooValue');   // WHERE evaluation = 'fooValue'
     * $query->filterByEvaluation('%fooValue%'); // WHERE evaluation LIKE '%fooValue%'
     * </code>
     *
     * @param     string $evaluation The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByEvaluation($evaluation = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($evaluation)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $evaluation)) {
                $evaluation = str_replace('*', '%', $evaluation);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::EVALUATION, $evaluation, $comparison);
    }

    /**
     * Filter the query on the qualifications column
     *
     * Example usage:
     * <code>
     * $query->filterByQualifications('fooValue');   // WHERE qualifications = 'fooValue'
     * $query->filterByQualifications('%fooValue%'); // WHERE qualifications LIKE '%fooValue%'
     * </code>
     *
     * @param     string $qualifications The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByQualifications($qualifications = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($qualifications)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $qualifications)) {
                $qualifications = str_replace('*', '%', $qualifications);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::QUALIFICATIONS, $qualifications, $comparison);
    }

    /**
     * Filter the query on the operational_area column
     *
     * Example usage:
     * <code>
     * $query->filterByOperationalArea('fooValue');   // WHERE operational_area = 'fooValue'
     * $query->filterByOperationalArea('%fooValue%'); // WHERE operational_area LIKE '%fooValue%'
     * </code>
     *
     * @param     string $operationalArea The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByOperationalArea($operationalArea = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($operationalArea)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $operationalArea)) {
                $operationalArea = str_replace('*', '%', $operationalArea);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::OPERATIONAL_AREA, $operationalArea, $comparison);
    }

    /**
     * Filter the query on the status column
     *
     * Example usage:
     * <code>
     * $query->filterByStatus(1234); // WHERE status = 1234
     * $query->filterByStatus(array(12, 34)); // WHERE status IN (12, 34)
     * $query->filterByStatus(array('min' => 12)); // WHERE status > 12
     * </code>
     *
     * @param     mixed $status The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByStatus($status = null, $comparison = null)
    {
        if (is_array($status)) {
            $useMinMax = false;
            if (isset($status['min'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::STATUS, $status['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($status['max'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::STATUS, $status['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::STATUS, $status, $comparison);
    }

    /**
     * Filter the query on the active column
     *
     * Example usage:
     * <code>
     * $query->filterByActive(true); // WHERE active = true
     * $query->filterByActive('yes'); // WHERE active = true
     * </code>
     *
     * @param     boolean|string $active The value to use as filter.
     *              Non-boolean arguments are converted using the following rules:
     *                * 1, '1', 'true',  'on',  and 'yes' are converted to boolean true
     *                * 0, '0', 'false', 'off', and 'no'  are converted to boolean false
     *              Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByActive($active = null, $comparison = null)
    {
        if (is_string($active)) {
            $active = in_array(strtolower($active), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::ACTIVE, $active, $comparison);
    }

    /**
     * Filter the query on the last_modified column
     *
     * Example usage:
     * <code>
     * $query->filterByLastModified('2011-03-14'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified('now'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified(array('max' => 'yesterday')); // WHERE last_modified > '2011-03-13'
     * </code>
     *
     * @param     mixed $lastModified The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByLastModified($lastModified = null, $comparison = null)
    {
        if (is_array($lastModified)) {
            $useMinMax = false;
            if (isset($lastModified['min'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::LAST_MODIFIED, $lastModified['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($lastModified['max'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::LAST_MODIFIED, $lastModified['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::LAST_MODIFIED, $lastModified, $comparison);
    }

    /**
     * Filter the query on the created column
     *
     * Example usage:
     * <code>
     * $query->filterByCreated('2011-03-14'); // WHERE created = '2011-03-14'
     * $query->filterByCreated('now'); // WHERE created = '2011-03-14'
     * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13'
     * </code>
     *
     * @param     mixed $created The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function filterByCreated($created = null, $comparison = null)
    {
        if (is_array($created)) {
            $useMinMax = false;
            if (isset($created['min'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::CREATED, $created['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($created['max'])) {
                $this->addUsingAlias(EmpevalSummaryPeer::CREATED, $created['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalSummaryPeer::CREATED, $created, $comparison);
    }

    /**
     * Filter the query by a related EmpevalBonusGoalsForms object
     *
     * @param   EmpevalBonusGoalsForms|PropelObjectCollection $bonusGoalsForms The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   EmpevalSummaryQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByBonusGoalsForms($bonusGoalsForms, $comparison = null)
    {
        if ($bonusGoalsForms instanceof EmpevalBonusGoalsForms) {
            return $this
                ->addUsingAlias(EmpevalSummaryPeer::BONUS_GOALS_FORM_ID, $bonusGoalsForms->getId(), $comparison);
        } elseif ($bonusGoalsForms instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(EmpevalSummaryPeer::BONUS_GOALS_FORM_ID, $bonusGoalsForms->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByBonusGoalsForms() only accepts arguments of type EmpevalBonusGoalsForms or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the BonusGoalsForms relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function joinBonusGoalsForms($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('BonusGoalsForms');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'BonusGoalsForms');
        }

        return $this;
    }

    /**
     * Use the BonusGoalsForms relation BonusGoalsForms object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   EmpevalBonusGoalsFormsQuery A secondary query class using the current class as primary query
     */
    public function useBonusGoalsFormsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinBonusGoalsForms($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'BonusGoalsForms', 'EmpevalBonusGoalsFormsQuery');
    }

    /**
     * Filter the query by a related EmpevalViewBgfWithSuperiorPositionId object
     *
     * @param   EmpevalViewBgfWithSuperiorPositionId|PropelObjectCollection $viewBgfWithSuperiorPositionId The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   EmpevalSummaryQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByViewBgfWithSuperiorPositionId($viewBgfWithSuperiorPositionId, $comparison = null)
    {
        if ($viewBgfWithSuperiorPositionId instanceof EmpevalViewBgfWithSuperiorPositionId) {
            return $this
                ->addUsingAlias(EmpevalSummaryPeer::BONUS_GOALS_FORM_ID, $viewBgfWithSuperiorPositionId->getId(), $comparison);
        } elseif ($viewBgfWithSuperiorPositionId instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(EmpevalSummaryPeer::BONUS_GOALS_FORM_ID, $viewBgfWithSuperiorPositionId->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByViewBgfWithSuperiorPositionId() only accepts arguments of type EmpevalViewBgfWithSuperiorPositionId or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function joinViewBgfWithSuperiorPositionId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('ViewBgfWithSuperiorPositionId');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'ViewBgfWithSuperiorPositionId');
        }

        return $this;
    }

    /**
     * Use the ViewBgfWithSuperiorPositionId relation ViewBgfWithSuperiorPositionId object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   EmpevalViewBgfWithSuperiorPositionIdQuery A secondary query class using the current class as primary query
     */
    public function useViewBgfWithSuperiorPositionIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinViewBgfWithSuperiorPositionId($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'ViewBgfWithSuperiorPositionId', 'EmpevalViewBgfWithSuperiorPositionIdQuery');
    }

    /**
     * Filter the query by a related EmpevalUsers object
     *
     * @param   EmpevalUsers|PropelObjectCollection $users The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   EmpevalSummaryQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByUsers($users, $comparison = null)
    {
        if ($users instanceof EmpevalUsers) {
            return $this
                ->addUsingAlias(EmpevalSummaryPeer::USER_ID, $users->getId(), $comparison);
        } elseif ($users instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(EmpevalSummaryPeer::USER_ID, $users->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByUsers() only accepts arguments of type EmpevalUsers or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the Users relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function joinUsers($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('Users');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'Users');
        }

        return $this;
    }

    /**
     * Use the Users relation Users object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   EmpevalUsersQuery A secondary query class using the current class as primary query
     */
    public function useUsersQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinUsers($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'Users', 'EmpevalUsersQuery');
    }

    /**
     * Exclude object from result
     *
     * @param   EmpevalSummary $summary Object to remove from the list of results
     *
     * @return EmpevalSummaryQuery The current query, for fluid interface
     */
    public function prune($summary = null)
    {
        if ($summary) {
            $this->addCond('pruneCond0', $this->getAliasedColName(EmpevalSummaryPeer::USER_ID), $summary->getUserId(), Criteria::NOT_EQUAL);
            $this->addCond('pruneCond1', $this->getAliasedColName(EmpevalSummaryPeer::BONUS_GOALS_FORM_ID), $summary->getBonusGoalsFormId(), Criteria::NOT_EQUAL);
            $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
        }

        return $this;
    }

}
